package kpi.java_training.testing;

import kpi.java_training.testing.user.UserData;
import kpi.java_training.testing.user.UserManager;

import java.io.IOException;

/**
 * Class which runs all the program
 */
public class Main {

    public static void main(String[] args) throws IOException {

        UserManager userManager = new UserManager();
        userManager.inputUserName();
        userManager.inputUserPassword();
        userManager.authenticateUser();

        if (userManager.getUser() != null){
            if (userManager.getUserType().equals("0")){
                // admin
                System.out.println("Welcome admin.");
                userManager.getUsersStatistics();
            }else{
                // user
                UserData userData = new UserData(userManager.getName());
                LearnSystem test = new LearnSystem(userData);
                test.startTesting();
            }
        }else {
            System.out.println("Wrong name or password.");
        }
    }
}
